/**
 * Date: 14-5-28
 * Time: 上午11:20
 * 动画工具类
 */
var AnimateUtil = {
    createWithSingleFrameN:function(imgName,delay,loops){
        var cache = cc.SpriteFrameCache.getInstance();
        var framesArr = [];

        var frame = null;

        var index = 1;

        do
        {
            //frame = cache.spriteFrameByName(CCString::createWithFormat("%s%d.png",imgName,index++)->getCString());
            var spriteImgName = imgName+(index++)+".png";
            frame = cache.getSpriteFrame(spriteImgName);
            //cc.log(spriteImgName)
            if(frame == null){
                break;
            }

            framesArr.push(frame);
        } while (true);

        var animation = cc.Animation.create(framesArr,delay);

        animation.setLoops(loops || 1);
        animation.setRestoreOriginalFrame(true);
        animation.setDelayPerUnit(delay);

        return animation;
    }
}